﻿<%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage<dynamic>" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>采购进货</title>
    <script src="../../Scripts/jquery-1.9.1.js" type="text/javascript"></script>
    <link href="../../Content/Themes/blue2/css.css" rel="stylesheet" type="text/css" />
</head>
<body class="main">
     <div class="AllWebTopDiv">
        <div class="path">
            <div class="nav">
                <a href="#">采购进货</a>
            </div>
        </div>
        <div class="content">
            <form id="add_goods" method="post">
            <table class="add_Table">
                <tr>
                    <td>
                        <label>
                            商品编号：</label>
                    </td>
                    <td class = "inputLeft">
                        <%:Html.TextBox("goodsId", null, new { @class = "Line", @readonly = "readonly" })%>
                    </td>
                    <td  class="tdpadding">
                        <label>
                            商品名称：</label>
                    </td>
                    <td class = "inputLeft">
                        <%:Html.TextBox("goodsName", null, new { @class = "Line", @readonly = "readonly" })%>
                    </td>
                </tr>
                
                <tr>
                    <td>
                        <label>
                            成本单价：</label>
                    </td>
                    <td class = "inputLeft">
                        <%:Html.TextBox("finalCost", null, new { @class = "Line", @readonly = "readonly" })%>
                    </td>
                    <td class="tdpadding">
                        <label>
                            商品售价：</label>
                    </td>
                    <td class = "inputLeft">
                        <%:Html.TextBox("price", null, new { @class = "Line", @readonly = "readonly" })%>
                    </td>
                </tr>
                <tr>
                    <td>
                        <label>
                            当前库存：</label>
                    </td>
                    <td class = "inputLeft">
                        <%:Html.TextBox("oldAmount", null, new {@class="Line",@readonly="readonly" })%>
                    </td>
                    <td class="tdpadding">
                        <label id="addNum">
                            进货数量：</label>
                    </td>
                    <td class = "inputLeft">
                        <%:Html.TextBox("addAmount", 0, new { @class = "Line", onblur="checkNumber(this)" })%>
                    </td>
                </tr>
                
            </table>
            <br />
            <br />
            <input type="submit" value="确认" class="button2" style=" margin-left:150px;"/>
             <input type="button" value="关闭" onclick="closeWindows()" class="button2"  style=" margin-left:50px;"/>
            </form>
         
        
        </div>

    </div>
</body>
</html>
<script type="text/javascript">

    var option = GetQueryString("option");
    var goodsId = GetQueryString("goodsId");
    if (parseInt(option) == 0) {
        $(document).attr("title", "采购进货");
        $(".nav a").text("采购进货");

    }
    else {
        if (parseInt(option) == 1) {
            $(".nav a").text("库房退货");
            $(document).attr("title", "库房退货");
            $("#addNum").text("退货数量:");
        }
    }
    
    function GetQueryString(name) {
        var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
        var r = window.location.search.substr(1).match(reg);
        if (r != null) return (r[2]); return null;
    }
    //判断是否为整数
    function checkNumber(o) {
        if (!String.prototype.trim) {
            var TRIM_REG = /(^\s*)|(\s*$)/g;
            String.prototype.trim = function () { return this.replace(TRIM_REG, ''); }
        }
        var m = o.value.trim();

        reg = /^[0-9]*[1-9][0-9]*$/;

        if (!reg.test(m)) {
            alert("需要输入大于0的整数");
            return false;
        }
        
            return true;
     
    }
    //关闭窗口
    function closeWindows() {
        var i = parent.layer.getFrameIndex();
        parent.layer.close(i);
    }
</script>
